package com.diy.yuhaofilm.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import org.jetbrains.anko.AnkoLogger
import org.jetbrains.anko.debug
import org.jetbrains.anko.toast

/**
 *@Class: BaseActivity
 *@Description:(所有Activity的基类)
 *@Date: 2021/4/1  16:42
 *@Company: 跟我学吧
 *@author: yuhao
 *@Version: v1.0
 */
abstract class BaseActivity : AppCompatActivity(),AnkoLogger {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getLayoutId())
        initData()
    }

    override fun onStart() {
        super.onStart()
        initListener()
    }

    /**
     * 初始化数据
     */

   open protected fun initData() {

    }

    /**
     * 初始化监听器
     */
    open protected fun initListener() {

    }

    abstract fun getLayoutId(): Int


    protected fun myToast(msg:String){
        runOnUiThread{
            toast(msg)
        }
    }
}